myApp.controller('loginCtrl', function ($cookieStore, $scope, $http, $rootScope, $window, CONFIG) {

    $scope.uLogin = function () {

        var url = "login/adminLogin";
        $http({
            method: 'post',
            //headers : {'languageColumn' : 'name_eu',
            //    'Content-Type':'application/x-www-form-urlencoded'},
            url: url,
            params: {
                name: $scope.name,
                password: hex_sha1($scope.password)
            }
        })
            .success(function (result, status) {

                if (result.resultCode == 001) {
                    $cookieStore.put("userName", result.admin.name);
                    $cookieStore.put("token", result.token);
                    $window.location.href = "/html/cusSpend.html";
                }
                else {
                    alert(result.resultMsg);
                }

            })
            .error(function () {
                alert("登录失败");
            });
    };

    $scope.uReset = function () {
        $scope.name = "";
        $scope.password = "";
    }


});